from langchain.chains import LLMChain
from langchain.prompts import PromptTemplate
from langchain.schema.messages import HumanMessage, SystemMessage, AIMessage
from langchain_community.llms.chatglm3 import ChatGLM3

from app.config import LLM_ADDR

class ChatGLM:
    def __init__(self, temperature :float = 0.5):
        endpoint_url = LLM_ADDR
        self.llm = ChatGLM3(
            endpoint_url=endpoint_url,
            max_tokens=8096,
            temperature=temperature,
            timeout=1000
        )

    def chat(self, str):
        return self.llm(str)